package edu.yngsxy.wkstudy.core.sys.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import edu.yngsxy.wkstudy.core.model.entity.WkBaseEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;
import jakarta.validation.constraints.*;
import io.swagger.v3.oas.annotations.media.Schema;
/**
 * <p>
 * 文章表
 * </p>
 *
 * @author group 2
 * @since 2025-09-09
 */
@Getter
@Setter
@ToString
@TableName("article")
@Accessors(chain = true)
@Schema(description = "文章表")
public class Article extends WkBaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 文章ID
     */
    @TableField(value = "article_id")
    @Schema(title = "文章ID", description = "文章ID", requiredMode =Schema.RequiredMode.REQUIRED)
    @NotNull(message = "文章ID不能为空")
    private Integer articleId;

    /**
     * 文章标题
     */
    @TableField("title")
    @Schema(title = "文章标题", description = "文章标题", requiredMode =Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "文章标题不能为空")
    @Size(max = 200, message = "文章标题长度不能超过200个字符")
    private String title;

    /**
     * 文章内容
     */
    @TableField("content")
    @Schema(title = "文章内容", description = "文章内容", requiredMode =Schema.RequiredMode.NOT_REQUIRED)
    @Size(max = 65535, message = "文章内容长度不能超过65,535个字符")
    private String content;

    /**
     * 作者ID（外键，关联User）
     */
    @TableField("author_id")
    @Schema(title = "作者ID（外键，关联User）", description = "作者ID（外键，关联User）", requiredMode =Schema.RequiredMode.NOT_REQUIRED)
    private Integer authorId;

    /**
     * 文章分类ID（外键，关联ArticleCategory）
     */
    @TableField("category_id")
    @Schema(title = "文章分类ID（外键，关联ArticleCategory）", description = "文章分类ID（外键，关联ArticleCategory）", requiredMode =Schema.RequiredMode.NOT_REQUIRED)
    private Integer categoryId;

    /**
     * 发布时间
     */
    @TableField("publish_time")
    @Schema(title = "发布时间", description = "发布时间", requiredMode =Schema.RequiredMode.REQUIRED)
    @NotNull(message = "发布时间不能为空")
    private LocalDateTime publishTime;
}
